package com.littcore.saap.system.biz.impl;

import java.util.List;

import javax.annotation.Resource;

import com.littcore.saap.system.biz.IRoleBizService;
import com.littcore.saap.system.dao.RoleDao;
import com.littcore.saap.system.po.Role;
import com.littcore.saap.system.vo.RoleVo;
import com.littcore.saap.system.webservice.IRoleWebService;
import com.littcore.util.BeanCopier;

public class RoleBizServiceImpl implements IRoleWebService, IRoleBizService {
	
	@Resource
	private RoleDao roleDao;
	
	@Override
	public List<RoleVo> listByUser(int userId) {
		String listHql = "select r from Role r, UserRole ur where r.id=ur.roleId and ur.userId=?";
		List<Role> roles = roleDao.listAll(listHql, new Object[]{userId});
		return BeanCopier.copyList(roles, RoleVo.class);
	}
	
	
	
}
